//
//  UITableViewCell+ZBValidate.m
//  PaoPao
//
//  Created by xzb on 2018/3/31.
//  Copyright © 2018年 paopao. All rights reserved.
//

#import "UITableViewCell+ZBValidate.h"

@implementation UITableViewCell (ZBValidate)

- (BOOL)validataCellModel:(id)cellModel
{
    if (!cellModel) {
        wLog(@"error: cellModel is nil");
        return NO;
    }
    Class cellModelClass = NSClassFromString([NSStringFromClass([self class]) stringByAppendingString:@"Model"]);
    if (!cellModelClass) {
       wLog(@"error:< %@ > is nil",[NSStringFromClass([self class]) stringByAppendingString:@"Model"]);
        return NO;
    }
    if (![cellModel isKindOfClass:cellModelClass]) {
          wLog(@"error: < %@ > not kind of < %@ > class",cellModel,cellModelClass);
        return NO;
    }
    return YES;
}

+ (BOOL)validataCellModel:(id)cellModel
{
    if (!cellModel) {
        wLog(@"error: cellModel is nil");
        return NO;
    }
    Class cellModelClass = NSClassFromString([NSStringFromClass(self) stringByAppendingString:@"Model"]);
    if (!cellModelClass) {
        wLog(@"error:< %@ > is nil",[NSStringFromClass(self) stringByAppendingString:@"Model"]);
        return NO;
    }
    if (![cellModel isKindOfClass:cellModelClass]) {
        wLog(@"error: < %@ > not kind of < %@ > class",cellModel,cellModelClass);
        return NO;
    }
    return YES;
}
@end
